version: "3.8"

include:
  - path: ./infra/docker-compose.variables.yaml
  - path: ./infra/observability/docker-compose.observability.yaml
  - path: ./infra/redis/docker-compose.redis.yaml
  - path: ./infra/postgres/docker-compose.postgres.yaml
  - path: ./infra/structurizer/docker-compose.structurize.yaml

services:
  tcs-gateway:
    container_name: tcs-gateway
    mem_reservation: "512m"
    cpus: "1"
    restart: unless-stopped
    healthcheck:
      test: curl -f http://localhost:8000/healthcheck || exit 1
      interval: 1m30s
      timeout: 10s
      retries: 3
    build:
      context: .
      dockerfile: ./src/tcs-gateway/TCS.Gateway.Presentation/Dockerfile
    ports:
      - "8000:80"
    depends_on:
      postgres:
        condition: service_healthy

  tcs-route:
    container_name: tcs-route
    mem_reservation: "512m"
    cpus: "1"
    restart: unless-stopped
    healthcheck:
      test: curl -f http://localhost:8001/healthcheck || exit 1
      interval: 1m30s
      timeout: 10s
      retries: 3
    build:
      context: .
      dockerfile: ./src/tcs-route/TCS.Route.Presentation/Dockerfile
    ports:
      - "8001:80"
    depends_on:
      postgres:
        condition: service_healthy

  tcs-trip:
    container_name: tcs-trip
    mem_reservation: "512m"
    cpus: "1"
    restart: unless-stopped
    healthcheck:
      test: curl -f http://localhost:8002/healthcheck || exit 1
      interval: 1m30s
      timeout: 10s
      retries: 3
    build:
      context: .
      dockerfile: ./src/tcs-trip/TCS.Trip.Presentation/Dockerfile
    ports:
      - "8002:80"
    depends_on:
      postgres:
        condition: service_healthy

  tcs-trip-creator:
    container_name: tcs-trip-creator
    mem_reservation: "512m"
    cpus: "1"
    restart: unless-stopped
    healthcheck:
      test: curl -f http://localhost:8003/healthcheck || exit 1
      interval: 1m30s
      timeout: 10s
      retries: 3
    build:
      context: .
      dockerfile: ./src/tcs-trip-creator/TCS.Trip.Creator.Presentation/Dockerfile
    ports:
      - "8003:80"
    depends_on:
      postgres:
        condition: service_healthy

  tcs-user-facade:
    container_name: tcs-user-facade
    mem_reservation: "512m"
    cpus: "1"
    restart: unless-stopped
    healthcheck:
      test: curl -f http://localhost:8004/healthcheck || exit 1
      interval: 1m30s
      timeout: 10s
      retries: 3
    build:
      context: .
      dockerfile: ./src/tcs-user-facade/TCS.User.Facade.Presentation/Dockerfile
    ports:
      - "8004:80"
    depends_on:
      postgres:
        condition: service_healthy
